function Rectangle(width,height) {
    this.width = width;
    this.height = height;

    this.color = "#ff0000";

    this.getArea = function() {
        // console.log("this.border = ",this.border);
       return this.width * this.height;
    }

    this.getPer = function() {
        return 2 * (width + height);
    }
}

// 直接赋值给类的变量，称为变量，也称为静态变量
// JS中类变量（静态变量），只能通过类名访问，不能通过实例访问。
Rectangle.border = "1px";

let react1 = new Rectangle(50,50);
console.log("面积：",react1.getArea())
// console.log("react1.border = ",react1.border);


// console.log("Rectangle.border = ",Rectangle.border);

// console.log("Math.PI =",Math.PI);


class Rectangle2 {
    constructor(width,height) {
        this.width = width;
        this.height = height;
    }

    // ES6直接使用static来定义类变量（静态变量）
    static border = "1px";

    getArea = function() {
        // console.log("this.border = ",this.border);
       return this.width * this.height;
    }

    getPer = function() {
        return 2 * (width + height);
    }
} 

console.log("Rectangle2.border = ",Rectangle2.border);